package admin

import (
	// 	_ "myblog/models"
	"fmt"

	"github.com/astaxie/beego"
	// 	"github.com/astaxie/beego/orm"
)

type BaseController struct {
	beego.Controller
}

func (c *BaseController) Prepare() {

	c.Data["custom_xsrf"] = c.XSRFToken()

	c.HasSession()

}

func (c *BaseController) Finish() {
}

func (c *BaseController) HasSession() {

	userinfo := c.GetSession("userinfo")

	if userinfo == nil {
		fmt.Print("123\n")
		// 跳转到登录页
		// c.TplName = "admin/login/login.html"
		c.Redirect("/admin/login", 302)
		// c.StopRun()
		return
	}
}
